<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Hexo | ChenBlue | 飞雪连天射白鹿 笑书神侠倚碧鸳</title>

  
  <meta name="author" content="ChenBlue">
  

  
  <meta name="description" content="学习笔记">
  

  
  
  <meta name="keywords" content="环境搭建,Hexo">
  

  <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">

  <meta property="og:title" content="Hexo"/>

  <meta property="og:site_name" content="ChenBlue"/>

  
  <meta property="og:image" content="/blog/favicon.ico"/>
  

  <link href="/blog/favicon.ico" rel="icon">
  <link rel="alternate" href="/blog/atom.xml" title="ChenBlue" type="application/atom+xml">
  <link rel="stylesheet" href="/blog/css/style.css" media="screen" type="text/css">
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
<div class="blog">
  <div class="content">

    <header>
  <div class="site-branding">
    <h1 class="site-title">
      <a href="/blog/">ChenBlue</a>
    </h1>
    <p class="site-description">飞雪连天射白鹿 笑书神侠倚碧鸳</p>
  </div>
  <nav class="site-navigation">
    <ul>
      
    </ul>
  </nav>
</header>

    <main class="site-main posts-loop">
    <article>

  
    
    <h3 class="article-title"><span>Hexo</span></h3>
    
  

  <div class="article-top-meta">
    <span class="posted-on">
      <a href="/blog/2021/07/25/hexo博客搭建/" rel="bookmark">
        <time class="entry-date published" datetime="2021-07-25T09:05:03.000Z">
          2021-07-25
        </time>
      </a>
    </span>
  </div>


  

  <div class="article-content">
    <div class="entry">
      
        <h1 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h1><p>node.js:因为Hexo是基于node的<br>git：主要用来推送静态页面<br>Hexo：将markdown文件转化成静态页面</p>
<h2 id="node安装"><a href="#node安装" class="headerlink" title="node安装"></a>node安装</h2><p><a target="_blank" rel="noopener" href="https://www.runoob.com/nodejs/nodejs-install-setup.html">可以参考菜鸟教程</a></p>
<h2 id="git安装"><a href="#git安装" class="headerlink" title="git安装"></a>git安装</h2><p><a target="_blank" rel="noopener" href="https://www.runoob.com/git/git-install-setup.html">参考菜鸟教程</a></p>
<h2 id="Hexo安装"><a href="#Hexo安装" class="headerlink" title="Hexo安装"></a>Hexo安装</h2><p>全局安装Hexo</p>
<pre class="language-none"><code class="language-none">npm install  hexo-cli -g</code></pre>
<p>在win磁盘上建立一个文件夹,并进入这个文件夹，在这个文件夹中右键-git bash here，调出git窗口</p>
<p>在黑窗口中运行命令,等待hexo初始化完成</p>
<pre class="language-none"><code class="language-none">hexo init</code></pre>
<p>初始化完成后下载依赖</p>
<pre class="language-none"><code class="language-none">npm install
npm install --save hexo-renderer-pug</code></pre>
<h2 id="测试"><a href="#测试" class="headerlink" title="测试"></a>测试</h2><p>清除生成的静态文件,以后每次发布博客都要执行此操作</p>
<pre class="language-none"><code class="language-none">hexo clean</code></pre>
<p>重新生成静态文件</p>
<pre class="language-none"><code class="language-none">hexo g</code></pre>
<p>启动hexo服务,这样在浏览器中访问localhost:4000就可以看到默认的博客了</p>
<pre class="language-none"><code class="language-none">hexo s</code></pre>

<p><strong>说明：hexo安装完成后默认会在 \source_posts\中生成hello-world.md文章,启动后默认就是看到这个。</strong></p>
<h1 id="Hexo配置"><a href="#Hexo配置" class="headerlink" title="Hexo配置"></a>Hexo配置</h1><p>根目录下的_config.yml为全局配置文件，相关的配置可以参考官网：</p>
<h2 id="网站配置"><a href="#网站配置" class="headerlink" title="网站配置"></a>网站配置</h2><pre class="language-none"><code class="language-none">title: ChenBlue #网站大标题
subtitle: &#39;飞雪连天射白鹿 笑书神侠倚碧鸳&#39; #网站子标题
description: &#39;ChenBlue&#39;    #这个是seo搜索引擎用的,很重要
keywords:
author: ChenBlue
language: zh-CN   #网站语言 zh-CN为中文
timezone: &#39;&#39;</code></pre>
<h2 id="主题配置"><a href="#主题配置" class="headerlink" title="主题配置"></a>主题配置</h2><pre class="language-none"><code class="language-none">#theme: landscape #默认是 landscape 主题，个人觉得不好看
theme: hexo-theme-stun #我使用的是stun这个主题</code></pre>
<p><strong>注意：这里这个名字如：hexo-theme-stun 要和/themes/下的主题文件夹的名称对应</strong></p>
<h2 id="写作图片配置"><a href="#写作图片配置" class="headerlink" title="写作图片配置"></a>写作图片配置</h2>
      
    </div>

  </div>

  <div class="article-footer">
    <div class="article-meta pull-left">

    
      

    <span class="post-categories">
      <i class="icon-categories"></i>
        <a href="/blog/categories/环境搭建/">环境搭建</a>
    </span>
    

    
    

    <span class="post-tags">
      <i class="icon-tags"></i>
        <a href="/blog/tags/环境搭建/">环境搭建</a><a href="/blog/tags/Hexo/">Hexo</a>
    </span>
    

    </div>

    
  </div>
</article>

  









    </main>

    <footer class="site-footer">
  <p class="site-info">
    Proudly powered by <a href="https://hexo.io/" target="_blank">Hexo</a> and
    Theme by <a href="https://github.com/CodeDaraW/Hacker" target="_blank">Hacker</a>
    </br>
    
    &copy; 2023 ChenBlue
    
  </p>
</footer>
    
    
  </div>
</div>
</body>
</html>